home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 October / CMCD1004.ISO / Software / Freeware / Utilitare / DesktopSidebar / Plugins / NotesEditor.DSPACKAGE / Source Code / DialogTranslator.cs < prev    next >
Encoding:
Text File  |  2004-05-16  |  1.1 KB  |  37 lines

  1. using System;
  2.  
  3. namespace DesktopSidebar
  4. {
  5.     /// <summary>
  6.     /// Summary description for DialogTranslator.
  7.     /// </summary>
  8.     public class DialogTranslator : IDialogTranslator
  9.     {
  10.         private System.Windows.Forms.Control form;
  11.  
  12.         public DialogTranslator(System.Windows.Forms.Control _form)
  13.         {
  14.             form=_form;
  15.         }
  16.     
  17.         public void SetCaption(string caption)
  18.         {
  19.             form.Text=caption;
  20.         }
  21.  
  22.         public void SetControl(string control, string caption)
  23.         {
  24.             System.Reflection.FieldInfo field=form.GetType().GetField(
  25.                 control,
  26.                 System.Reflection.BindingFlags.Instance|
  27.                 System.Reflection.BindingFlags.Public|
  28.                 System.Reflection.BindingFlags.NonPublic);
  29.             if (field!=null && field.FieldType.IsSubclassOf(typeof(System.Windows.Forms.Control)))
  30.             {
  31.                 System.Windows.Forms.Control obj=(System.Windows.Forms.Control)field.GetValue(form);
  32.                 obj.Text=caption;
  33.             }
  34.         }
  35.     }
  36. }
  37.